#ifndef MAINWIDGET_H
#define MAINWIDGET_H

#include <QWidget>
#include <QAction>
#include <QTableWidgetItem>
#include <QDebug>
#include <QMessageBox>
#include "livemasterwidget.h"
#include "liveslavewidget.h"
#include "loginwidget.h"

class HouseCreateWidget;
class TcpSession;

namespace Ui {
class MainWidget;
}

class MainWidget : public QWidget
{
    Q_OBJECT

public:
    explicit MainWidget(TcpSession* session, LoginWidget* loginWidget,const QString & username, const QString & nickname,
                        QWidget *parent = nullptr);
    //
    void resizeEvent(QResizeEvent *event) override;
    void show();
    void show(TcpSession* session, LoginWidget* loginWidget,const QString & username, const QString & nickname);

private slots:
    void on_tableWidget_cellDoubleClicked(int row, int column);
    void on_pushButton_logout_clicked();
    void on_pushButton_createHouse_clicked();

    void on_houselist_ret_signal(const QStringList& fields);
    void on_logout_call_signal(const QString& msg);
    void on_house_enter_signal(bool res, const QString & msg="");


private:
    Ui::MainWidget *ui;
    LoginWidget* loginWidget=nullptr;
    LiveMasterWidget* masterWidget=nullptr;
    LiveSlaveWidget* slaveWidget=nullptr;
    HouseCreateWidget* houseCreateWidget=nullptr;
    //当前用户名
    QString username;
    QString nickname;
    //网络
    TcpSession* session=nullptr;
};

#endif // MAINWIDGET_H
